package com.rdtravel.services;

import com.rdtravel.entities.Booking;

/**
 * Services for {@link com.rdtravel.entities.Booking} Entities
 * 
 * @author Hans
 * 
 */

public interface BookingsService {
	/**
	 * 
	 * @param booking
	 *            the {@link com.rdtravel.entities.Booking} to create
	 * @throws com.rdtravel.exceptions.AnotherCustomerBookedTheSameTripAtTheSameMomentException
	 *             if another user booked the same
	 *             {@link com.rdtravel.entities.Trip} at the same time
	 * 
	 * @throws com.rdtravel.exceptions.InvalidEntityException
	 *             if the {@link com.rdtravel.entities.Booking} contains invalid
	 *             properties
	 * @throws com.rdtravel.exceptions.NotEnoughAvaiableSeatsException
	 *             if the seats in the {@link com.rdtravel.entities.Booking} are
	 *             more than than the available seats in trip
	 *             {@link com.rdtravel.entities.Trip} for which you book
	 */

	void create(Booking booking);

	/**
	 * 
	 * @param booking
	 *            the {@link com.rdtravel.entities.Booking} in which to the
	 *            price and discount must be filled.<br/>
	 *            The price is taken from the booked
	 *            {@link com.rdtravel.entities.Trip}<br/>
	 *            The discount is taken from the
	 *            {@link com.rdtravel.entities.Parameters}
	 */

	void setPriceAndDiscounts(Booking booking);

	/**
	 * 
	 * @param id
	 *            the id of the {@link com.rdtravel.entities.Booking} to find
	 * @return the {@link com.rdtravel.entities.Booking} with this id<br/>
	 *         <code>null</code> if no {@link com.rdtravel.entities.Booking}
	 *         with this is id is found
	 */

	Booking findById(long id);
}
